package chenji.yourticket.pricecalculator;

import java.util.HashMap;

import org.bukkit.entity.Player;

public class LimitManager {
	private HashMap<String, Integer> miao = new HashMap<String, Integer>();
	private int defaultlinit;
	

	public void addLimit(String PermissionName, int limit) {
		this.miao.put(PermissionName, limit);
	}

	public void setDefaultLimit(int l) {
		this.defaultlinit = l;
	}

	public int getLimit(Player p) {
		System.out.println(miao);
		int nowLimit = this.defaultlinit;
		for (String s : miao.keySet()) {
			if (p.hasPermission("YourTicket.VIPLimit." + s)) {
				if (nowLimit < miao.get(s)) {
					nowLimit = miao.get(s);
				}
			}
		}
		System.out.println(nowLimit);
		return nowLimit;
	}
}
 